﻿using System;
using System.Web.Mvc;

using mvcForum.Core;
using mvcForum.Core.Abstractions.Interfaces;
using mvcForum.Core.Interfaces.Services;

namespace mvcForum.Web.Filters {

	public class ExceptionFilter : IExceptionFilter {

		public void OnException(ExceptionContext filterContext) {
			// It's an unhandled exception, let's log it!
			DependencyResolver.Current.GetService<ILogger>().Log(EventType.Error, String.Format("Exception filter caught exception. The exception has been handled: {0}", filterContext.ExceptionHandled), filterContext.Exception);
		}
	}
}